package character;

import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import java.io.IOException;
import mygame.DefaultValues;

public class CharacterSettings implements Savable {
    protected float mass, radius, height, stepHeight, walkSpeed, runSpeed;
    protected int buildSpeed, harvestSpeed;

    public float getRadius() {
	return radius;
    }

    public void setRadius(float radius) {
	this.radius = radius;
    }

    public float getHeight() {
	return height;
    }

    public void setHeight(float height) {
	this.height = height;
    }

    public float getStepHeight() {
	return stepHeight;
    }

    public void setStepHeight(float stepHeight) {
	this.stepHeight = stepHeight;
    }

    public float getMass() {
	return mass;
    }

    public void setMass(float mass) {
	this.mass = mass;
    }

    public float getRunSpeed() {
	return runSpeed;
    }

    public void setRunSpeed(float runSpeed) {
	this.runSpeed = runSpeed;
    }

    public float getWalkSpeed() {
	return walkSpeed;
    }

    public void setWalkSpeed(float walkSpeed) {
	this.walkSpeed = walkSpeed;
    }

    public int getBuildSpeed() {
	return buildSpeed;
    }

    public void setBuildSpeed(int buildSpeed) {
	this.buildSpeed = buildSpeed;
    }

    public int getHarvestSpeed() {
	return harvestSpeed;
    }

    public void setHarvestSpeed(int harvestSpeed) {
	this.harvestSpeed = harvestSpeed;
    }

    public void write(JmeExporter ex) throws IOException {
	OutputCapsule capsule = ex.getCapsule(this);
	capsule.write(mass, "mass", DefaultValues.CHARACTER_SETTING_MASS);
	capsule.write(radius, "radius", DefaultValues.CHARACTER_SETTING_RADIUS);
	capsule.write(height, "height", DefaultValues.CHARACTER_SETTING_HEIGHT);
	capsule.write(stepHeight, "stepHeight", DefaultValues.CHARACTER_SETTING_STEP_HEIGHT);
	capsule.write(walkSpeed, "walkSpeed", DefaultValues.CHARACTER_SETTING_WALK_SPEED);
	capsule.write(runSpeed, "runSpeed", DefaultValues.CHARACTER_SETTING_RUN_SPEED);
	capsule.write(buildSpeed, "buildSpeed", DefaultValues.CHARACTER_SETTING_BUILD_SPEED);
	capsule.write(harvestSpeed, "harvestSpeed", DefaultValues.CHARACTER_SETTING_HARVEST_SPEED);
    }

    public void read(JmeImporter im) throws IOException {
	InputCapsule capsule = im.getCapsule(this);
	mass = capsule.readFloat("mass", DefaultValues.CHARACTER_SETTING_MASS);
	radius = capsule.readFloat("radius", DefaultValues.CHARACTER_SETTING_RADIUS);
	height = capsule.readFloat("height", DefaultValues.CHARACTER_SETTING_HEIGHT);
	stepHeight = capsule.readFloat("stepHeight", DefaultValues.CHARACTER_SETTING_STEP_HEIGHT);
	walkSpeed = capsule.readFloat("walkSpeed", DefaultValues.CHARACTER_SETTING_WALK_SPEED);
	runSpeed = capsule.readFloat("runSpeed", DefaultValues.CHARACTER_SETTING_RUN_SPEED);
	buildSpeed = capsule.readInt("buildSpeed", DefaultValues.CHARACTER_SETTING_BUILD_SPEED);
	harvestSpeed = capsule.readInt("harvestSpeed", DefaultValues.CHARACTER_SETTING_HARVEST_SPEED);
    }

}
